package leetcode;

import java.util.Scanner;

/**
 * ClassName: ShuenfT1
 * Package: leetcode
 * Description:
 *
 * @Author wjn
 * @Create 2025/9/7 09:57
 * @Version 1.0
 */
public class ShuenfT2_1 {
    private static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        if (n == 1) {
            System.out.println(9);
            return;
        }
        long dp0 = 8;
        long dp1 = 0;
        long dp2 = 1;
        for (int i = 2; i <= n; i++) {
            long newDp0 = (dp0 * 8 + dp1 * 8) % MOD;
            long newDp1 = dp2 * 8 % MOD;
            long newDp2 = dp0 * 8 % MOD;
            dp0 = newDp0;
            dp1 = newDp1;
            dp2 = newDp2;
        }
        long result = (dp0 + dp1 + dp2) % MOD;
        System.out.println(result);

    }
}
